/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.unesp.demac.soo.ws;

import br.unesp.demac.bcc.soo.bean.Aluguel;
import br.unesp.demac.bcc.soo.bean.AluguelRel;
import br.unesp.demac.bcc.soo.bean.Dvd;
import br.unesp.demac.bcc.soo.bean.Login;
import br.unesp.demac.bcc.soo.bean.Pessoa;
import br.unesp.demac.soo.dao.AluguelDAO;
import br.unesp.demac.soo.dao.AluguelDAOImp;
import br.unesp.demac.soo.dao.DvdDAO;
import br.unesp.demac.soo.dao.DvdDAOImp;
import br.unesp.demac.soo.dao.LoginDAO;
import br.unesp.demac.soo.dao.LoginDAOImp;
import java.util.ArrayList;
import java.util.Date;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author flavioam
 */
@WebService(serviceName = "LocadoraWS")
public class LocadoraWS {

    /**
     * Operação de serviço web
     */
    @WebMethod(operationName = "relatorioAluguelCliente")
    public ArrayList<AluguelRel> relatorioAluguelCliente(@WebParam(name = "pessoa") Pessoa p, @WebParam(name = "tudo") boolean tudo) {

        AluguelDAO aDao = new AluguelDAOImp();

        return aDao.selecionaDvdsAlugadosByCliente(p, tudo);
    }

    /**
     * Operação de serviço web
     */
    @WebMethod(operationName = "filmesMaisAlugados")
    public java.util.ArrayList<Dvd> filmesMaisAlugados(@WebParam(name = "dataInicio") Date dataInicio, @WebParam(name = "dataFim") Date dataFim, @WebParam(name = "quantFilmes") int quantFilmes) {
        //TODO write your implementation code here:

        DvdDAO dDao = new DvdDAOImp();
        return dDao.selecionaRanking(dataInicio, dataFim, quantFilmes);
    }

    /**
     * Operação de serviço web
     */
    @WebMethod(operationName = "autenticacao")
    public Boolean autenticacao(@WebParam(name = "Login") Login Login) {
        //TODO write your implementation code here:        
        LoginDAO lDao = new LoginDAOImp();
        return lDao.autenticacao(Login);
    }

    /**
     * Operação de serviço web
     */
    @WebMethod(operationName = "relatorioAtrasoCliente")
    public ArrayList<AluguelRel> relatorioAtrasoCliente(@WebParam(name = "pessoa") Pessoa p) {
        //TODO write your implementation code here:
        AluguelDAO aDao = new AluguelDAOImp();

        return aDao.selecionaDvdsAtrasadosByCliente(p);
    }
}
